package com.micai.springboot.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;

/**
 * 指定对应于集合user
 * Created by 赵新国 on 2017/12/4.
 */
@Document(collection = "user")
@CompoundIndexes({
        @CompoundIndex(name = "userName_phone", def = "{'userName': 1, 'phone': -1}")
})
public class UserEntity implements Serializable {

    /**
     * 主键
     */
    @Id
    private String id;
    @Indexed
    private String userName;
    private String passWord;
    @Indexed
    private String phone;

    public UserEntity() {
    }

    public UserEntity(String id, String userName, String passWord, String phone) {
        this.id = id;
        this.userName = userName;
        this.passWord = passWord;
        this.phone = phone;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}
